﻿CREATE TABLE [dbo].[RolePermission]
(
	[Id] [dbo].[Id] NOT NULL  IDENTITY(1000000000, 1), 
    [RoleId] [dbo].[Id] NOT NULL, 
    [PermissionId] [dbo].[Id] NOT NULL, 
    [Granted] BIT NOT NULL, 
    [Denied] BIT NOT NULL, 
    [CreateId] [dbo].[Name] NOT NULL , 
    [CreateDateTime] [dbo].[CreateModifiedDateTime] NOT NULL , 
    [ModifiedId] [dbo].[Name] NOT NULL , 
    [ModifiedDateTime] [dbo].[CreateModifiedDateTime] NOT NULL , 
    CONSTRAINT [PK_RolePermission] PRIMARY KEY (Id), 
    CONSTRAINT [AK_RolePermission_RoleId_PermissionId] UNIQUE (RoleId, PermissionId), 
    CONSTRAINT [FK_RolePermission_Role_RoleId] FOREIGN KEY (RoleId) REFERENCES Role(Id), 
    CONSTRAINT [FK_RolePermission_Permission_PermissionId] FOREIGN KEY (PermissionId) REFERENCES Permission(Id)
)
